package com.example.finalassignment.mapper;

import com.example.finalassignment.pojo.TechnologyInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
* @author guocheng
* @description 针对表【technology_info】的数据库操作Mapper
* @createDate 2024-06-03 11:23:39
* @Entity com.example.finalassignment.pojo.TechnologyInfo
*/
public interface TechnologyInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(TechnologyInfo record);

    int insertSelective(TechnologyInfo record);

    TechnologyInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TechnologyInfo record);

    int updateByPrimaryKey(TechnologyInfo record);

    @Update("update technology_info set watch = watch + 1 where uuid = #{uuid}")
    int updateDraftsByUUIDToWatch(@Param("uuid")String uuid);

    /**
     * 加1
     * @param uuid
     * @return
     */
    @Update("update technology_info set stars = stars + 1 where uuid = #{uuid}")
    int updateDraftsByUUIDToStarsAdd(@Param("uuid")String uuid);

    /**
     * 减1
     * @param uuid
     * @return
     */
    @Update("update technology_info set stars = GREATEST(stars - 1, 0) where uuid = #{uuid}")
    int updateDraftsByUUIDToStarsCut(@Param("uuid")String uuid);
}
